package com.fognl.core.net.handler;

/** A requestHandle to a request made to the Network handler. Used to refer to it after it's been initiated. */ 
public class RequestHandle
{
	/** The time this request was initiated */
	private long timestamp;
	/** The request in question. */
	private Request request;
	
	/*package*/
	ResponseListener responseListener;
	
	/* package */
	RequestHandle(Request request, ResponseListener responseListener)
	{
		super();
		this.request = request;
		this.responseListener = responseListener;
		timestamp = System.currentTimeMillis();
		
		if(this.request != null)
			request.setHandle(this);
	}
	
	public long getTimestamp() { return timestamp; }
	public Request getRequest() { return request; }
	
	public String toString()
	{
		return "{timestamp=" + timestamp + " request=" + request + "}"; 
	}
}

